<template>
	<view class="d-flex flex-column j-sb px-3 py-3">
		<view class="d-flex a-center j-sb" style="margin-bottom: 10upx;">
			<text style="font-size: 34rpx;font-weight: 900;margin-left: -18upx;">【{{dataObj.title}}】</text>
			<text style="color: #CCCCCC;font-size: 24rpx;" @tap="handleMore(dataObj)">更多</text>
		</view>
		<view class="border-bottom">
			<scroll-view scroll-x="true" class="scroll-row" style="height: 434rpx;">
				<template v-for="(item, index) in cardList">
					<card-item :key="index" :cardData="item"></card-item>
				</template>
			</scroll-view>
		</view>
		<poster-module v-if="adverObj.length > 0" :item="adverObj[0]"></poster-module>
	</view>
</template>

<script>
	import posterModule from '@/components/module/poster-module.vue';
	import cardItem from '@/components/module/card-item.vue';
	export default {
		data() {
			return {
				moreText: '更多'
			};
		},
		components: {
			posterModule,
			cardItem
		},
		computed: {
			adverObj() {
				let arr = [];
				if (this.dataObj.list && this.dataObj.list.length > 0) {
					arr = this.dataObj.list.filter(item => {
						return item.type === 'ADVERTISEMENT';
					});
					return arr;
				} else {
					return []
				}
			},
			cardList() {
				let arr = [];
				if (this.dataObj.list && this.dataObj.list.length > 0) {
					arr = this.dataObj.list.filter(item => {
						return item.type === 'INDEPENDENCE';
					});
					return arr;
				} else {
					return [];
				}
			}
		},
		props: {
			dataObj: {
				type: Object,
				default: () => {
					return {
						"module": "zjpl1",
						"title": "专家评楼",
						"moduleType": "zjpl",
						"list": [{
								"title": "丽景湾还不错",
								"buildingName": "丽景湾",
								"description": "丽景湾还不错",
								"releaseDataDes": "刚刚",
								"customViews": "1",
								"authorName": "hugh",
								"origin": "中国房地产网",
								"type": "INDEPENDENCE",
								"commentCount": 0,
								"thumb": "http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/251607430rh8.png",
								"contentId": 99742,
								"url": "http://www.creb.com.cn/mobile/dynamic.jhtml?id=99742"
							},
							{
								"title": "这个楼不行",
								"buildingName": "汤臣一品",
								"description": "这个楼还差点",
								"releaseDataDes": "2分前",
								"customViews": "12",
								"authorName": "12",
								"origin": "中国房地产网",
								"type": "INDEPENDENCE",
								"commentCount": 0,
								"thumb": "http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/25160536ad5v.png",
								"contentId": 99741,
								"url": "http://www.creb.com.cn/mobile/dynamic.jhtml?id=99741"
							},
							{
								"title": "这个楼不错",
								"buildingName": "高尔夫花园",
								"description": "真的不错",
								"releaseDataDes": "3分前",
								"customViews": "111",
								"authorName": "账单",
								"origin": "中国房地产网",
								"type": "INDEPENDENCE",
								"commentCount": 0,
								"thumb": "http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201912/25160433dfn7.png",
								"contentId": 99740,
								"url": "http://www.creb.com.cn/mobile/dynamic.jhtml?id=99740"
							},
							{
								"title": "海南将在地图上修正“维也纳酒店”，律师：政策不应违反常理",
								"buildingName": "首开金帝·华悦北京",
								"releaseDataDes": "187天前",
								"customViews": "23",
								"authorName": "文菁",
								"origin": "中国房地产网",
								"type": "INDEPENDENCE",
								"commentCount": 0,
								"thumb": "http://cmszfb.oss-cn-beijing.aliyuncs.com/u/cms/www/201906/20171013j11b.png",
								"contentId": 69391,
								"url": "http://www.creb.com.cn/mobile/dynamic.jhtml?id=69391"
							}
						]
					};
				}
			}
		},
		methods:{
			handleMore(data){
				console.log(data)
				uni.navigateTo({
					url:'/pages/index/more/more?title=' + data.title
				})
			}
		},
	};
</script>

<style></style>
